using System;
using System.Collections.Generic;
using System.Configuration;
using System.Text;
using System.Xml;

using Microsoft.VisualStudio.TestTools.UnitTesting;

using OR.Lazarus.Library.CPP.Rules;
using System.IO;
using OR.Reuse.Persistence;

namespace OR.Lazarus.Library.Tests.CPP
{
	/// <summary>
	/// Summary description for RulesTests
	/// </summary>
	[TestClass]
    [Ignore]
	public class RulesTests : CPPTestBase< RulesetDetail >
	{
		public RulesTests()
		{
			//
			// TODO: Add constructor logic here
			//
		}

		#region Additional test attributes
		//
		// You can use the following additional attributes as you write your tests:
		//
		// Use ClassInitialize to run code before running the first test in the class
		// [ClassInitialize()]
		// public static void MyClassInitialize(TestContext testContext) { }
		//
		// Use ClassCleanup to run code after all tests in a class have run
		// [ClassCleanup()]
		// public static void MyClassCleanup() { }
		//
		// Use TestInitialize to run code before running each test 
		// [TestInitialize()]
		// public void MyTestInitialize() { }
		//
		// Use TestCleanup to run code after each test has run
		// [TestCleanup()]
		// public void MyTestCleanup() { }
		//
		#endregion

		[TestInitialize()]
		public void CPP_Rules_TestInitialize()
		{
			this.InitializePersistence();
			this.InitializeDetail( "Rules.xml" );
		}

		[TestMethod]
		public void CPP_Rules_Load()
		{
			// Validate contents
			Assert.IsTrue( mDetail.Includes.Count == 1, String.Format( ErrorInvalidCount, "Includes", 1, mDetail.Includes.Count ) );
			Assert.IsTrue( mDetail.ClassRules.Count == 3, String.Format( ErrorInvalidCount, "Class Rules", 3, mDetail.ClassRules.Count ) );
			Assert.IsTrue( mDetail.VariableRules.Count == 3, String.Format( ErrorInvalidCount, "Variable Rules", 3, mDetail.VariableRules.Count ) );
			Assert.IsTrue( mDetail.MethodRules.Count == 4, String.Format( ErrorInvalidCount, "Method Rules", 4, mDetail.MethodRules.Count ) );

			MethodRuleDetail vMethodRule = mDetail.MethodRules[ 0 ];

			Assert.IsTrue( vMethodRule.Filters.Count == 1, String.Format( ErrorInvalidCount, "Method Rule Filters", 1, vMethodRule.Filters.Count ) );
		}
	}
}
